/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SISAC.DACEA.DA;

import SISAC.DACEA.DS.Conexion;
import SISAC.DACEA.ENTITY.Tutor;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;

/**
 *
 * @author Abel
 */
public class TutorDA {
    public synchronized boolean registrarTutor(Tutor oTutor){
        Connection cn=null;
        CallableStatement call=null;
        
        try {
            String sql= "{CALL registrarTutor(?,?,?,?,?,?,?,?,?)}";
           
            cn=new Conexion().getConnection();
            call=cn.prepareCall(sql);
            
            call.registerOutParameter(1, Types.INTEGER);
            call.setString(2, oTutor.getDni());
            call.setDouble(3, oTutor.getSueldo());
            call.setString(4, oTutor.getNombre());
            call.setString(5, oTutor.getApePaterno());
            call.setString(6, oTutor.getApeMaterno());
            call.setString(7, oTutor.getTelefono());
            call.setString(8, oTutor.getEmail()); 
            call.setBoolean(9, oTutor.getEstado());
            
            
            call.executeUpdate();
            return true;
        } catch (Exception e) {
            System.out.println("ErrorDA"+e);
            return false;
        }
        
    }
}
